/**
 * 广告相关请求模块
 */

import request from '@/utils/request'

export const getAdList = (params: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/getAdList',
    params
  })
}

// 获取所有的广告位置
export const getAllSpaces = () => {
  return request({
    method: 'GET',
    url: '/front/ad/space/getAllSpaces'
  })
}

// 分页获取广告位
export const getAdSpacesList = (params: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/space/getAllSpaces',
    params
  })
}

// 根据 id 获取广告位
export const getSpaceById = (params: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/space/getSpaceById',
    params
  })
}

// 保存广告位信息
export const saveOrUpdateSpace = (data: any) => {
  return request({
    method: 'POST',
    url: '/front/ad/space/saveOrUpdate',
    data
  })
}

// 修改广告上下线
export const updateSpaceStatus = (params: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/updateStatus',
    params
  })
}

// 保存广告信息
export const createOrUpdateAdvert = (data: any) => {
  return request({
    method: 'POST',
    url: '/front/ad/saveOrUpdate',
    data
  })
}

// 根据id获取广告信息
export const getAdById = (params: any) => {
  return request({
    method: 'GET',
    url: '/front/ad/getAdById',
    params
  })
}
